Import('RTT_ROOT')
Import('rtconfig')
from building import *

cwd     = os.path.join(str(Dir('#')), 'drivers')

# add the general drivers.
src = Split("""
board.c
stm32f10x_it.c
usart.c
eeprom.c
GDEW042T2.c
adc_dev.c
""")

if GetDepend(['RT_USING_PIN']):
    src += ['gpio.c']

# add canbus driver.
if GetDepend('RT_USING_CAN'):
    src += ['bxcan.c']

# add Ethernet drivers.
if GetDepend('RT_USING_LWIP'):
    src += ['dm9000a.c']

# add Ethernet drivers.
if GetDepend('RT_USING_DFS'):
    src += ['sdcard.c']

# add Ethernet drivers.
if GetDepend('RT_USING_RTC'):
    src += ['stm32f1_rtc.c']

# add Ethernet drivers.
if GetDepend('RT_USING_RTGUI'):
    src += ['touch.c']
    if rtconfig.RT_USING_LCD_TYPE == 'ILI932X':
        src += ['ili_lcd_general.c']
    elif rtconfig.RT_USING_LCD_TYPE == 'SSD1289':
        src += ['ssd1289.c']

# add wdt driver.
if GetDepend('RT_USING_WDT'):
    src += ['stm32f1_wdg.c']

    
CPPPATH = [cwd]

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)

Return('group')
